﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace SharedLib.XmlDataModel
{
	/// <summary>
	/// Interface of the basic data model
    /// <para>All data objects implementing this interface will have the ability to import from / export to Xml</para>
	/// </summary>
    public interface IXmlDataModel
    {
        /// <summary>
        /// Export content to an Xml node
        /// <para>Note: the exported node will be attached to the given Xml document</para>
        /// </summary>
        /// <param name="doc">Xml document of the exporting node</param>
        /// <returns>Exported node</returns>
        XmlElement ToXmlNode(XmlDocument doc);

        /// <summary>
        /// Export content to an Xml node
        /// <para>Note: the exported node will be an unattached Xml element</para>
        /// </summary>
        /// <returnsExported node></returns>
        XmlElement ToXmlNode();

        /// <summary>
        /// Export content to an Xml node
        /// </summary>
        /// <returns></returns>
        XmlDocument ToXmlDocument();

        /// <summary>
        /// Export content to Xml text
        /// </summary>
        /// <param name="doc">Xml document to be used</param>
        /// <returns>Exported Xml text</returns>
        string ToXmlText(XmlDocument doc);

        /// <summary>
        /// Export content to Xml text
        /// </summary>
        /// <returns>Exported Xml text</returns>
        string ToXmlText();

        /// <summary>
        /// Load content from Xml text
        /// </summary>
        /// <param name="xmlText">Xml text to be imported</param>
        void LoadXml(String xmlText);

        /// <summary>
        /// Load content from Xml node
        /// </summary>
        /// <param name="node">Xml node to be imported</param>
        void LoadXmlNode(XmlNode node);

        /// <summary>
        /// Get Xml root node name
        /// </summary>
        string RootNodeName { get; }
    }
}
